<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>关键字</title>
		
		<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
	<meta http-equiv="description" content="This is my page" />
		 <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/themes/flexigrid/css/flexigrid.css" />
		<script type="text/javascript" src="<%=request.getContextPath() %>/script/jquery.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/script/grid/flexigrid.js"></script>
		<style type="text/css" media="all"> 
			@import "<%=request.getContextPath() %>/themes/flexigrid/css/thickbox.css"; 
		</style>
		<link rel="alternate stylesheet" type="text/css" href="<%=request.getContextPath() %>/themes/flexigrid/css/1024.css" title="1024 x 768" />
		<script src="<%=request.getContextPath() %>/script/grid/thickbox.js" type="text/javascript"></script>
		

	</head>

	<body>
	
	<div class="bborderx">
		<table id="flex1" style="display:none"></table>
	</div>
	
		<script type="text/javascript">
			$("#flex1").flexigrid
			(
			{
			url: '<%=request.getContextPath() %>/keyWord.do?method=standGridQuery',
			dataType: 'json',
			errormsg: '连接错误！',
			colModel : [
				{display: '主键', name : 'id', width : 60, sortable : true, align: 'left',hide: true},
				{display: '编号', name : 'numid', width : 60, sortable : true, align: 'center'},
				{display: '名称', name : 'keyword_name', width : 120, sortable : true, align: 'left'},
				{display: '点击次数', name : 'keyword_clickNum', width : 120, sortable : true, align: 'left'},
				{display: '填写人', name : 'sys_fille', width : 120, sortable : true, align: 'left'},
				{display: '填写时间', name : 'sys_time', width : 120, sortable : true, align: 'left'}
				],
			buttons : [
				{name: '请选择', bclass: 'add', onpress : exOperation},
				{separator: true}
				],
			searchitems : [
				{display: '名称', name : 'keyword_name', isdefault: true}
				],
			sortname: "keyword_clickNum",
			sortorder: "asc",
			usepager: true,
			title: '关键字',
			useRp: true,
			singleSelect: false,
			ifDblclick: false,
			rp: 10,
			showTableToggleBtn: true,
			width: 750,
			height: 200
			}
			);
			
			//操作数据
			function exOperation(com,grid){
				if (com=='请选择'){
					if( $('.trSelected',grid).length>0){
						 var  keyword_name ="";
						 $('.trSelected td:nth-child(3) div',grid).each(function(i){   
				                if(i)keyword_name+=',';   
				                keyword_name+=$(this).text();   
				            }) 
				            var pkeywords =  window.opener.document.all.keywords.value;
				            if(pkeywords.lastIndexOf(",")==-1){
				            	pkeywords+",";
				            }
				            pkeywords += keyword_name;
				            window.opener.document.all.keywords.value = pkeywords;
				            window.close();
				        return keyword_name;
				        
					 }else{
					   alert("请选择某行删除！");
					 }
				}
			}	
	     	
	</script>

	</body>
</html>
